<?php $this->headScript()->appendFile(HTTP_HOST.'/js/site-admin/countries.js'); ?>

<?php if (sizeof($this->countries) > 0) { ?>
<?php $i = 1;?>
<div id="cat_table_div">
<table id="cat_table">
	<tr class="head">
		<td class="checkbox_td"></td>
		<td class="__table_code"><?=$this->translate('Код')?></td>
		<td><?=$this->translate('Страна')?></td>
		<td class="active_td">-</td>
		<td class="_table_sort_td"><?=$this->translate('Сортировка')?></td>
		<td colspan="2" class="right_angle"></td>
	</tr>
	<tr id="subhead">
		<td class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td class="_table_code"><input type="text" name="code" id="code_field" maxlength="10"/></td>
		<td><input type="text" name="search_region" id="search_region" maxlength="255"/></td>
		<td class="active_td">-</td>
		<td class="_table_sort_td">-</td>
		<td colspan="2" class="search_image"><img src="<?=HTTP_HOST; ?>/images/controll/zoom.png" alt="" class="zoom_icon"/></td>
	</tr>	
	<?php foreach ($this->countries as $k => $v) { ?>
		<?php $i++;?>
		<tr class="cl" <?=(!is_int($i/2))?"style='background: #e1e0e0;'":""; ?>>
			<td class="checkbox_td"><input type="checkbox" name="<?=$v['ID']?>" class="country_ch"></td>
			<td class="_table_code"><?=$v['ID']?></td>
			<?php $id = $v['ID']; ?>
			<td class="_table_title"><a href="<?=$this->url(array('controller' => 'region', 'action' => 'index', 'country'=>$v['ID']))?>"><?=$v['Name']?></a></td><!-- Страна -->
			<td class="active_td"><img src="<?=HTTP_HOST; ?>/images/controll/<?=$v['active'] == 0 ? 'inactive.png' : 'active.png'?>" alt="" class="state" id="state-<?=$v['ID']?>"/></td><!-- Активный/Неактивный -->
			<td class="_table_sort_td"><input type="text" class="sort_field" name="sort" value="<?=$v['sort']?>"/></td><!-- Сортировка -->
			<td class="edit_td"><a href="<?=$this->url(array('action' => 'edit', 'id' => $k))?>"><img src="<?=HTTP_HOST; ?>/images/controll/edit.png" alt="" class="ed-del-btn"/></a></td>
			<td class="del_td"><div id="<?=$v['ID']?>" class="del_ot" rel="<?=$v['Name']?>" ><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn"/></div></td>
		</tr>
	<?php } ?>
	<tr class="table_footer cl">
		<td id="ch" class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td colspan="6" id="footer_ico"><div id="group_delete"><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn"/><div id="delete_label"><?=$this->translate('Удалить')?></div></div>
			<div id="_add_new_object_div">
				<a href="<?=$this->url(array('controller' => 'country', 'action' => 'edit', 'addnew' => 1))?>">
					<img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/>
					<?=$this->translate('Добавить страну')?>
				</a>
			</div>
			
			<div id="_add_new_object_div">
				<img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/>
				<a href="<?=$this->url(array('controller' => 'country-page', 'action' => 'edit', 'addnew' => 1))?>">
					<?=$this->translate('Добавить странцу')?>
				</a>
			</div>
		</td>
	</tr>
</table>
<div id="table_shadow"></div>
</div>
<?php } else {?>
	<div id="_add_new_object_div">
		<a href="<?=$this->url(array('controller' => 'country', 'action' => 'edit', 'addnew' => 1))?>">
			<img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/>
			<?=$this->translate('Добавить страну')?>
		</a>
	</div>
<?php }?>